package com.strato.quartz.v1_0_0.schedule.jobstore;

public class JobStoreTxConfig extends AbstractJobStoreConfig {

	public static final String DATABASE_TYPE_HSQLDB="hsqldb";
	public static final String DATABASE_TYPE_MYSQL="mysql";
	public static final String DATABASE_TYPE_POSTGRE="postgre";
	
	public static final String AUTO_DETECT_DRIVER_DELEGATE="AUTO";
	
	private String dataSourceName=null;

	private String databaseType;
	
	private String tablePrefix="QRTZ_";
	
	private String driverDelegateClass=AUTO_DETECT_DRIVER_DELEGATE;
	
	public void setDriverDelegateClass(String driverDelegateClass) {
		this.driverDelegateClass = driverDelegateClass;
	}

	public String getTablePrefix() {
		return tablePrefix;
	}

	public void setTablePrefix(String tablePrefix) {
		this.tablePrefix = tablePrefix;
	}

	public String getDatabaseType() {
		return databaseType;
	}

	public void setDatabaseType(String databaseType) {
		this.databaseType = databaseType;
	}

	public String getDriverDelegateClass() {
		if(!AUTO_DETECT_DRIVER_DELEGATE.equals(driverDelegateClass)){
			return driverDelegateClass;
		}
		if(DATABASE_TYPE_HSQLDB.equals(databaseType)){
			return "org.quartz.impl.jdbcjobstore.HSQLDBDelegate";
		}else if(DATABASE_TYPE_POSTGRE.equals(databaseType)){
			return "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate";
		}
		return "org.quartz.impl.jdbcjobstore.StdJDBCDelegate";
	}

	public String getDataSourceName() {
		return dataSourceName;
	}

	public void setDataSourceName(String dataSourceName) {
		this.dataSourceName = dataSourceName;
	}
	
}
